1. Field of the Invention
The present invention relates to the field of digital video systems. More specifically, the present invention relates to quantization error detection in these digital video systems.
2. Background
In digital video systems, it is common to find digital video data being shifted/modified from one range to another, for example, from 0-255 to 16-235. The digital video data may be shifted/modified for various purposes including but not limited to filtering. In the process of shifting/modifying digital data, rounding errors will occur. In the example of shifting/modifying data from 0-255 to 16-235, the 8-bit output data would be computed from the transfer function Data.sub.-- out =Truncated (Data.sub.-- in .times.(219/255) +16). A number of numerically adjacent Data.sub.-- in values will be shifted/modified to the same Data.sub.-- out values. For examples, Data.sub.-- out would be 16 for both Data.sub.-- in=0, and Data.sub.-- in=1, while Data.sub.-- out would be 22 for both Data.sub.-- in=7 and Data.sub.-- in=8. Very often dynamic companding or rounding will be employed to minimize the impact of rounding errors, a phenomenon which can manifest itself as visual banding. Dynamic companding is a process that varies quantization ranges in order to mask the rounding errors, or visual banding, by rounding up or rounding down based on probability, rather than simply truncating.
However, there is a tradeoff in using dynamic companding to ameliorate the rounding error situation. Random noise is introduced into the video image as a result of rounding up or down based on probability. The additional random noise can reduce the clarity of the image, as an entire frame will have additional noise. Thus, it is desirable if the digital video system would perform dynamic companding on the digital video data only when necessary. Then, the rounding error problem can be ameliorated with minimal compromise to the video quality of the video image.
Particular examples of situations where dynamic companding is "necessary" include the situations where rounding errors of numerically adjacent values occur horizontally and/or vertically adjacent to each other in a frame, i.e. when the numerical adjacent values of two horizontally and/or vertically adjacent pixels in a frame are going to be rounded to the same shifted/modified value by the transfer function. The two situations are illustrated by the exemplary horizontally adjacent XX and vertically adjacent YY values in the exemplary frame in FIG. 10, where X and Y are two arbitrary shifted/modified values.
A further example of another situation where dynamic companding is "necessary" is the situation where rounding errors of numerically adjacent values occur temporally adjacent to each other in two successive frames, i.e. when the numerically adjacent values of two temporally adjacent pixels in two successive frames are going to be rounded to the same shifted/modified value by the transfer function. The situation is illustrated by the exemplary temporally adjacent TT values in the two exemplary successive frames in FIG. 10, where T is also an arbitrary shifted/modified value.
As will be disclosed, the present invention provides a method and apparatus for detecting digital video data quantization errors of numerically adjacent values in spatially and/or temporally adjacent pixels, thereby enabling the above described desirable results to be achieved.